import { NoteEntity } from './../entities/note.entity';
import { NoteService } from './note.service';
import { Controller, Get, ParseIntPipe, Query } from '@nestjs/common';

@Controller('note')
export class NoteController {
  constructor(private readonly noteService: NoteService) {}

  @Get('list')
  findAdd(): Promise<NoteEntity[]> {
    return this.noteService.findAll();
  }

  @Get('noteById')
  findById(@Query('id', ParseIntPipe) id: any) {
    return this.noteService.getTitleById(id);
  }

  @Get('addRecord')
  addRecord(@Query() data: any) {
    return this.noteService.addOneRecord(data.id, data.title, data.content);
  }
}
